<?php
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
cfc('core')->checklogin();
$item=$this->plugin_setting('setting');
if($_RQ['op']=='main'){
	$info=pdo_get('jy_taxi_driver',array('mid'=>$_SESSION['uid']));
	if($info&&$info['status']==0){
			exi('您的申请正在审核，请耐心等待','','/index/');
	}
	if($info&&$info['status']==1){
			exi('您已经申请成为司机，无需重复申请','','/index/'); 
	}
	$return['info']=$info;
	exi($return);
}
if($_RQ['op']=='set'){
	$postdata=get_postdata();
	if(!$postdata['name']){
		exi('请填写姓名','error');
	}
	if(!$postdata['mobile']){
		exi('请填写手机号','error');
	}
	if(!$postdata['idcard']){
		exi('请填写身份证号','error');
	}
	$data=array(
				'name'=>$postdata['name'],
				'sex'=>$postdata['sex'],
				'mobile'=>$postdata['mobile'],
				'idcard'=>$postdata['idcard'],
				'carid'=>$postdata['carid'],
				'address'=>$postdata['address'],
				'bx'=>$postdata['bx'],
				'cid'=>$postdata['cid'],
	);
	if($item['shenhe']==1){
		$data['status']=0;
	}else{
		$data['status']=1;
	}
	$info=pdo_get('jy_taxi_driver',array('mid'=>$_SESSION['uid']));
	if($info){
		pdo_update('jy_taxi_driver',$data,array('mid'=>$_SESSION['uid']));
	}else{
	$data['mid']=$_SESSION['uid'];
	$data['uniacid']=$_SESSION['uniacid'];
	pdo_insert('jy_taxi_driver',$data);
	exi('申请成功','','/home/');
	}
}
?>